Serial Number Marking
Serial number marking is widely used in traceability and part identification applications in the laser marking industry. Serialization applications range from marking alphanumeric serial numbers to marking complex data matrix or barcode-based serial numbers. And the marking process heavily depends on the capabilities of the laser marking controllers and software to automate the process.
SMAPI provides an easy-to-use interface for serial number marking with many useful features.
Basic workflow
After creating a scan Document, define a serial variable and attach it to the Scandocument. The scan Document act as the placeholder for the serial variable and will increment it after every scan cycle. You can define many serial variables and attach them to the Scandocument. The output of the serial variable should be formatted with desired formatting string, before using it for marking.
Create a vector image and add a dynamic shape to it. Dynamic Text shape, Dynamic Arc text Shape and Any barcode shape can be used for serial number marking.
Assign a serial variable to the dynamic shape. When a marking cycle gets completed, the scan document will increment the serial variables, and accordingly, the dynamic shapes will get updated with the new values.
This process can be automated using the ScanScript scripting language to interface with external hardware to create a complete automated serial number marking process.
Defining a serial variable
Define a serial number object in your project and add it to the scan Document.
//Create serial number
SerialNumber serialVar1 = new SerialNumber("serialVar");
//Add serialNumber to scandocument
scanDocument.AddSerialNumberVariable(serialVar1);
Formatting the output text
The output of the serial variable can be formatted using the pre-defined styles. The API provides the following styles for formatting the serial number output.
TextSerialItem | Fixed text output |
UserSerialItem | User name |
NewLineSerialItem | A new line break in output text |
NumberSerialItem | A number output |
DateSerialItem | A date out put |
TimeSerialItem | A time out put |
Add formatting items as many as required to the SerialItemList, to format the out put . The styles will be processed in the order they have been defined.
// Output format "Serial No:001" to "Serial No:100"
TextSerialItem fixedText = new TextSerialItem();
fixedText.Text = "Serial No:";
serialVar1.SerialItemList.Add(fixedText);
NumberSerialItem numberSerialItem = new NumberSerialItem();
numberSerialItem.IsCurrentNumberEnabled = true;
numberSerialItem.IsRemoveLeadingZero = false;
numberSerialItem.StartNumber = 0f;
numberSerialItem.CurrentNumber = 0f;
numberSerialItem.EndNumber = 100f;
numberSerialItem.Increment = 1f;
numberSerialItem.FixedLength = 3;
numberSerialItem.RepeatCount = 1;
numberSerialItem.NumarelRepresentation = NumberSystemStyle.Decimal;
serialVar1.SerialItemList.Add(numberSerialItem);
Stop and resume
It is possible to stop a serial number marking iteration and resume back from where it stopped. There is also an expiration time interval which tells the controller to discard the saved serial number information and reset the serial number to start from the beginning.
//Save serialization instance data to SMC
scanDocument.IsSaveAndUseSerailizationState = true;
//Time to expire the serialization instance data
scanDocument.SerailizationStateSaveDataExpirationTime = 1;
Defining the Dynamic Shape and attaching the serial variable
Once the serial variable is defined and formatted, a dynamic shape can be defined to mark the serial number.
//Dynamic Text
DynamicTextShape dynamicText = new DynamicTextShape();
dynamicText.Height = 5;
dynamicText.Location = new Point3D(0, 0, 0);
dynamicText.VariableName = "dynText1";
dynamicText.Text = " ";
dynamicText.EvaluateVariableTags = true;
dynamicText.FontName = "Arial";
dynamicText.CharacterGap = 0;
dynamicText.ScaleX = 1;
dynamicText.ScaleY = 1;
dynamicText.Angle = 0;
// Embed Font
Collection<UnicodeRange> unicodeRanges = new Collection<UnicodeRange>();
UnicodeRange unicodeRange = new UnicodeRange();
unicodeRange.StartingCharacter = Convert.ToChar(0x00);
unicodeRange.EndingCharacter = Convert.ToChar(0xff); // Characters from 0 to 255 or basically extended ASCII range is embedded
unicodeRanges.Add(unicodeRange);
scanDocument.EmbedFont("Arial", FontStyle.Regular, unicodeRanges);
vectorImage.AddDynamicText(dynamicText, new SerialNumberEx(serialVar1));
scanDocument.Scripts.Add(new ScanningScriptChunk("Default", "ScanAll()"));
The serial number variable will be updated real-time during the marking process, therefore the marking engine will re-process the dynamic shape after every marking cycle to create the subsequent shapes required for serial number marking. Since the controllers do not store Font information, required fonts should be embedded with the Scandocument.